package com.fs.alert.socketio.service.impl;

import com.corundumstudio.socketio.SocketIOServer;
import com.fs.alert.socketio.service.SocketIOOperations;
import com.fs.common.domain.Result;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Service
@Slf4j
@RequiredArgsConstructor
public class SocketIOOperationsImpl implements SocketIOOperations {
    private final SocketIOServer server;

    @Override
    public void sendEvent(String eventName, Object data) {
        log.info("发送事件名: {} 数据: {}", eventName, data);
        server.getBroadcastOperations().sendEvent(eventName, Result.ok(data));
    }
}

